package com.bwei.mypaot.home.adapter;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.bwei.mypaot.R;
import com.bwei.mypaot.home.Person;

import java.util.ArrayList;
import java.util.HashMap;

/**
 * Created by Administrator on 2017/2/27.
 */

public class ContactAdapter extends BaseAdapter {
    Context  context;
    ArrayList<Person> list;
    private TextView name;
    private TextView phonenum;

    public ContactAdapter(Context context, ArrayList<Person> list) {
        this.context = context;
        this.list = list;
    }

    @Override
    public int getCount() {
        return list.size();
    }

    @Override
    public Object getItem(int position) {
        return null;
    }

    @Override
    public long getItemId(int position) {
        return 0;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        if (convertView==null){
            convertView=View.inflate(context, R.layout.contacts_item,null);

        }
        name = (TextView) convertView.findViewById(R.id.name);
        phonenum = (TextView) convertView.findViewById(R.id.phonenum);
        name.setText(list.get(position).name);
        phonenum.setText(list.get(position).phone);

        return convertView;
    }
}
